# -*- coding: utf-8 -*-
from match import Extractor
import regex as re


class QianKeExtractor(Extractor):

    # 悔罪适用于所有罪名，所以直接返回True
    @staticmethod
    def is_my_job(file_path):
        return True

    @staticmethod
    def extract(text):
        result = {}
        is_lei_fan = re.search(r"((?<!没有|无|没有犯罪|无犯罪)前科(?!查询))", text) is not None
        result["前科"] = int(is_lei_fan)
        if result["前科"] == 0:
            result["前科"] += 2
        return result


if __name__ == '__main__':
    print(QianKeExtractor.extract("有前科"))
